<?php
    require_once('../includes/DbConnector.php');
    
    if(isset($_POST['action']) && !empty($_POST['action'])) {
        // INPUT DATA.
        $userid = $_POST['userid'];
        $barid = $_POST['barid'];
        $comment = $_POST['comment'];
        $connector  = new DbConnector();
        
        $sql = "insert into comment(user_id, bar_id, comment, date, time) 
                VALUES('$userid', '$barid','$comment', curdate(), curtime());";
        $result = $connector->query($sql);
        
        if($result){
            echo "Success";
        }
        
    }
?>